<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <!--<script src="http://{$Think.config.google_map_url}" async="async"></script>-->
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <style>
        .layui-upload-img{
            width: 100px;
        }
    </style>
</head>
<body>
<div style="margin-top: 20px;">
</div>

<form class="layui-form" id="admin">

    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">行程名称</label>-->
        <!--<div class="layui-input-inline" style="width: 500px">-->
            <!--<input value="{notempty name='$menu'}{$menu.name}{/notempty}" autocomplete="off" class="layui-input" type="text" readonly="readonly">-->
        <!--</div>-->
    <!--</div>-->
    {notempty name="$menu"}
    <input type="hidden" name="id" value="{$menu.id}">
    {/notempty}


    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">FAQ</label>
        <div class="layui-input-block" style="max-width:500px;">
            <textarea placeholder="请输入内容" class="layui-textarea" id="faq" name="faq" style="height:500px;">{notempty name='$menu'}{$menu.faq}{/notempty}</textarea>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>


<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>

<script>
    layui.use(['layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        $(window).on('load', function() {
            form.on('submit(admin)', function(data) {
                $.ajax({
                    url:"{:url('admin/product/faq')}",
                    data:$('#admin').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                });
                return false;
            });
        });
    });


</script>
</body>
</html>
